package com.yanqu.road.server.manger.activity.entername;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.entername.ChannelFightMatchRule;
import com.yanqu.road.entity.activity.entername.ChannelFightZone;

import java.util.List;
import java.util.Random;

public class EnterNameActivityConfig {

    ActivityInfo activityInfo;

    public EnterNameActivityConfig(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    private int nameTime;

    private int groupTime;

    /**
     * 散财奖励
     */
    private String disperseGoldReward;

    /**
     * 分组规则配置
     */
    private List<ChannelFightMatchRule> matchRuleList;

    /**
     * 地区配置
     */
    private List<ChannelFightZone> fightZoneList;

    /**
     * 勋章id
     */
    private int medalId;

    //自动报名
    private String SIGN_UP_LIMIT;

    //瓦舍的配置
    //连胜对应获得积分
    private String AREAFIGHT_SCORE_WIN;
    //失败获得积分
    private int AREAFIGHT_SCORE_LOSE;


    public int getAreaIdByMemberCode(int areaCode, Random random){
        for (ChannelFightZone fightZone : fightZoneList) {
            if(fightZone.getZoneList().contains(areaCode)){
                return fightZone.getAreaId();
            }
        }
        ChannelFightZone fightZone = fightZoneList.get(random.nextInt(fightZoneList.size()));
        return fightZone.getAreaId();
    }

    public boolean init(){
        return true;
    }

    public void setActivityInfo(ActivityInfo activityInfo) {
        this.activityInfo = activityInfo;
    }

    public ActivityInfo getActivityInfo() {
        return activityInfo;
    }

    public int getNameTime() {
        return nameTime;
    }

    public void setNameTime(int nameTime) {
        this.nameTime = nameTime;
    }

    public int getGroupTime() {
        return groupTime;
    }

    public void setGroupTime(int groupTime) {
        this.groupTime = groupTime;
    }

    public List<ChannelFightMatchRule> getMatchRuleList() {
        return matchRuleList;
    }

    public void setMatchRuleList(List<ChannelFightMatchRule> matchRuleList) {
        this.matchRuleList = matchRuleList;
    }

    public List<ChannelFightZone> getFightZoneList() {
        return fightZoneList;
    }

    public ChannelFightZone getChannelFightZone(int zoneId){
        for (ChannelFightZone fightZone : fightZoneList) {
            if(zoneId == fightZone.getAreaId()){
                return fightZone;
            }
        }
        return null;
    }

    public void setFightZoneList(List<ChannelFightZone> fightZoneList) {
        this.fightZoneList = fightZoneList;
    }

    public String getDisperseGoldReward() {
        return disperseGoldReward;
    }

    public void setDisperseGoldReward(String disperseGoldReward) {
        this.disperseGoldReward = disperseGoldReward;
    }

    public int getMedalId() {
        return medalId;
    }

    public void setMedalId(int medalId) {
        this.medalId = medalId;
    }

    public String getSIGN_UP_LIMIT() {
        return SIGN_UP_LIMIT;
    }

    public void setSIGN_UP_LIMIT(String SIGN_UP_LIMIT) {
        this.SIGN_UP_LIMIT = SIGN_UP_LIMIT;
    }

    public String getAREAFIGHT_SCORE_WIN() {
        return AREAFIGHT_SCORE_WIN;
    }

    public void setAREAFIGHT_SCORE_WIN(String AREAFIGHT_SCORE_WIN) {
        this.AREAFIGHT_SCORE_WIN = AREAFIGHT_SCORE_WIN;
    }

    public int getAREAFIGHT_SCORE_LOSE() {
        return AREAFIGHT_SCORE_LOSE;
    }

    public void setAREAFIGHT_SCORE_LOSE(int AREAFIGHT_SCORE_LOSE) {
        this.AREAFIGHT_SCORE_LOSE = AREAFIGHT_SCORE_LOSE;
    }
}
